package com.haierp.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.haierp.model.PackageLevel;
import com.haierp.service.IFreightService;
import com.haierp.service.IPackageLevelService;
import com.haierp.service.IPackageScaleService;

@Service
public class FreightServiceImpl  implements IFreightService {
	@Autowired
	private IPackageLevelService iPackageLevelService;
	
	@Override
	public Long calculateFreight(Double itemWeight, Double packageWeight) {
		Long fee = 3500l;
		double d = (itemWeight+packageWeight -0.5)/0.1d;
		long a = (long)Math.ceil(d);
		if(d>=0){
			fee+=a*500;
		}
		return fee;
	}
	@Override
	public PackageLevel getPackageLevel(Long id) {
		return iPackageLevelService.selectById(id);
	}

	
}
